<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>QQ简易聊天框</title>
    <link rel="stylesheet" href="css/chat.css">
</head>
<body>
<section id="chat">
    <div class="chatBody"></div>
    <div><img src="images/icon.jpg"></div>
    <textarea class="chatText"></textarea>
    <div class="btn"><span>关闭(C)</span><span id="send">发送(S)</span></div>
</section>
<script src="js/jquery-1.12.4.js"></script>
<!--<script src="js/chat.js"></script>-->
<script>
    $(document).ready(function(){
        var uName=new Array("伊人","奇迹","松松");
        var phone=new Array("head01.jpg","head02.jpg","head03.jpg");
        $("#send").click(function () {
            if ($(".chatText").val()!=""){
                var j=Math.floor(Math.random()*3);
                var str="<section>";
                str+=" <div><img src=\"images/"+phone[j]+"\"></div>";FGJ
                str+=" <p>"+uName[j]+"</p>><div class=\"chatContent\">"+$(".chatText").val();
                str+=" </div>";
                str+=" </section>";
                $(".chatBody").html( $(".chatBody").html()+str);
            }
        });
    });
</script>
</body>
</html>